package com.eyered.covereasydesign;


import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

public class MainActivity extends TabActivity {
	// declare tabhost
	private TabHost tabHost;
	private int[] iListIcon = { R.drawable.icon_best3_01,
			R.drawable.icon_best3_01, R.drawable.icon_best3_01,
			R.drawable.icon_best3_01,R.drawable.icon_best3_01  };
	private int[] iListLabel = { R.string.tab_home, R.string.tab_rank,
			R.string.tab_search, R.string.tab_book, R.string.tab_list };

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_layout);
		tabHost = getTabHost();
		// TODO Auto-generated method stub
		setTab(1);
	}

	public void setTab(int currentTab) {
		addTab(tabHost, getResources().getString(iListLabel[0]), iListIcon[0],
				HelloActivity.class, this);
		addTab(tabHost, getResources().getString(iListLabel[1]), iListIcon[1],
				HelloActivity.class, this);
		addTab(tabHost, getResources().getString(iListLabel[2]), iListIcon[2],
				HelloActivity.class, this);
		addTab(tabHost, getResources().getString(iListLabel[3]), iListIcon[3],
				HelloActivity.class, this);
		addTab(tabHost, getResources().getString(iListLabel[4]), iListIcon[4],
				HelloActivity.class, this);
		tabHost.setCurrentTab(currentTab);

	}

	public void addTab(TabHost tabHost, String labelId, int drawableId,
			Class<?> c, TabActivity tabActivity) {
		Intent intent = new Intent(this, c);
		TabHost.TabSpec spec = tabHost.newTabSpec(labelId);

		spec.setIndicator(labelId,getResources().getDrawable(drawableId));
		spec.setContent(intent);
		tabHost.addTab(spec);
	}
}
